package com.qys.livesMall.shortVideo.controller.app;

import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.qys.livesMall.common.result.R;
import com.qys.livesMall.framework.utils.SecurityUtils;
import com.qys.livesMall.shortVideo.model.dto.app.AppVideoUserDTO;
import com.qys.livesMall.shortVideo.model.vo.app.AppUserCollectionLikeVO;
import com.qys.livesMall.shortVideo.service.ShortVideoUserService;
import io.swagger.v3.oas.annotations.Operation;
import io.swagger.v3.oas.annotations.tags.Tag;
import lombok.RequiredArgsConstructor;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;

/**
 * Created by IntelliJ IDEA.
 * User: dp
 * Date: 2023/06/06
 * Time: 15:54
 * DESCRIPTION:
 */
@RestController
@Tag(name = "app-用户短视频关联信息")
@RequestMapping("/app/short/user")
@RequiredArgsConstructor(onConstructor = @__(@Autowired))
public class AppShortVideoUserController {

    private final ShortVideoUserService videoUserService;

    @PostMapping("/page/{type}")
    @Operation(
            summary = "查询用户收藏/点赞短视频信息"
    )
    public R<Page<AppUserCollectionLikeVO>> page(@PathVariable String type, @RequestBody AppVideoUserDTO videoUserDTO) {
        if (type.equals("like")) videoUserDTO.setType((byte) 0);
        videoUserDTO.setUserId(SecurityUtils.getUserId());
        return R.ok(videoUserService.pageByApp(videoUserDTO));
    }
}
